<template>
  <div class="order-list-container">
    <h3 class="module-title">📦 订单管理模块（来自远程应用）</h3>
    <div class="order-table">
      <div class="table-header">
        <span>订单号</span>
        <span>客户</span>
        <span>金额</span>
        <span>状态</span>
      </div>
      <div class="table-body">
        <div class="table-row" v-for="order in orderList" :key="order.id">
          <span>{{ order.orderNumber }}</span>
          <span>{{ order.customerName }}</span>
          <span class="amount">¥{{ order.amount.toFixed(2) }}</span>
          <span :class="['status', order.status]">{{ order.statusText }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
// 模拟订单数据
const orderList = [
  { id: 1, orderNumber: 'ORD-2023001', customerName: '张三', amount: 1299.50, status: 'paid', statusText: '已支付' },
  { id: 2, orderNumber: 'ORD-2023002', customerName: '李四', amount: 850.00, status: 'shipped', statusText: '已发货' },
  { id: 3, orderNumber: 'ORD-2023003', customerName: '王五', amount: 2580.75, status: 'pending', statusText: '待支付' },
  { id: 4, orderNumber: 'ORD-2023004', customerName: '赵六', amount: 568.20, status: 'completed', statusText: '已完成' }
];
</script>

<style scoped>
.order-list-container {
  padding: 20px;
  background-color: #f5f5f5;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.module-title {
  color: #333;
  margin-bottom: 20px;
  font-size: 18px;
}

.order-table {
  width: 100%;
  background-color: white;
  border-radius: 4px;
  overflow: hidden;
}

.table-header {
  display: flex;
  background-color: #fff2e8;
  font-weight: bold;
  padding: 12px 20px;
  border-bottom: 1px solid #d9d9d9;
}

.table-header span {
  flex: 1;
  color: #fa8c16;
}

.table-body {
  padding: 0;
}

.table-row {
  display: flex;
  padding: 12px 20px;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.3s;
}

.table-row:hover {
  background-color: #fafafa;
}

.table-row span {
  flex: 1;
  color: #333;
}

.table-row .amount {
  font-weight: bold;
  color: #f5222d;
}

.status {
  text-align: center;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
}

.status.paid {
  background-color: #f6ffed;
  color: #52c41a;
  border: 1px solid #b7eb8f;
}

.status.shipped {
  background-color: #e6f7ff;
  color: #1890ff;
  border: 1px solid #91d5ff;
}

.status.pending {
  background-color: #fffbe6;
  color: #faad14;
  border: 1px solid #ffe58f;
}

.status.completed {
  background-color: #f9f0ff;
  color: #722ed1;
  border: 1px solid #d3adf7;
}

.table-row:last-child {
  border-bottom: none;
}
</style>